/*
Trie tree introduction: 
     http://zh.wikipedia.org/wiki/Trie
Problem:
     pku 1204
     http://poj.org/problem?id=1204
*/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

typedef struct Node {
    Node * next[26];
    int wordIndex;
	Node() {
		memset(next, 0, sizeof(next));
		wordIndex = -1;
	}
}Node;

Node head;
int w, h, n;
char tu[1005][1005];
char word[1005];
bool flag[1005];
int cnt = 0;

int movex[] = {-1,-1, 0, 1, 1,  1,  0, -1};
int movey[] = { 0, 1, 1, 1, 0, -1, -1, -1};
int ans[1005][3];

void init() {
     scanf("%d%d%d", &h, &w, &n);     
     for (int i = 0; i < h; ++i) {
         scanf("%s", tu[i]);
     }
}

void insert(Node * cur, char *s) {
     while ( *s ) {
         int pos = *s - 'A';
         if (cur->next[pos] == NULL) {
             Node * node = new Node();
             cur->next[pos] = node;
         }
		 cur = cur->next[pos];
         s++;
     }
     cur->wordIndex = cnt++;
}

void buildTrieTree() {
     for (int i = 0; i < n; ++i) {
         scanf("%s", word);
         insert(&head, word);
     }
}

void search(int x, int y, int d) {
	 int ox = x;
	 int oy = y;
     Node * node = &head;
     while (true) {
           char ch = tu[x][y] - 'A';
           if (node->next[ch] != NULL) {
               node = node->next[ch];
               if (node->wordIndex != -1) {
				  // printf("Get %d %d %c for word %d \n", ox, oy, 'A' + d, node->wordIndex);
                  ans[node->wordIndex][0] = ox;
				  ans[node->wordIndex][1] = oy;
				  ans[node->wordIndex][2] = d;
				 // flag[node->wordIndex] = true;
			   }
               x += movex[d];
               y += movey[d];
               if (x < 0 || y < 0 || x >= h || y >= w) 
                  return ;
           } else {
               return ; 
           }
     }
}

void solve() {
	 int i, j, k;
	 cnt = 0;
     for (i = 0; i < h; ++i) 
         for (j = 0; j < w; ++j)
             for (k = 0; k < 8; ++k) {
                 search(i, j, k);
             }
	 for (i = 0; i < n; ++i) {
		 printf("%d %d %c\n", ans[i][0], ans[i][1], ans[i][2] + 'A');
	 }
}

int main()
{
    init();
    buildTrieTree();
    solve();
    
    // system("pause");
    return 0;
}

/*

20 20 10
QWSPILAATIRAGRAMYKEI
AGTRCLQAXLPOIJLFVBUQ
TQTKAZXVMRWALEMAPKCW
LIEACNKAZXKPOTPIZCEO
FGKLSTCBTROPICALBLBC
JEWHJEEWSMLPOEKORORA
LUPQWRNJOAAGJKMUSJAE
KRQEIOLOAOQPRTVILCBZ
QOPUCAJSPPOUTMTSLPSF
LPOUYTRFGMMLKIUISXSW
WAHCPOIYTGAKLMNAHBVA
EIAKHPLBGSMCLOGNGJML
LDTIKENVCSWQAZUAOEAL
HOPLPGEJKMNUTIIORMNC
LOIUFTGSQACAXMOPBEIO
QOASDHOPEPNBUYUYOBXB
IONIAELOJHSWASMOUTRK
HPOIYTJPLNAQWDRIBITG
LPOINUYMRTEMPTMLMNBO
PAFCOPLHAVAIANALBPFS
CAMPONESA


MARGARITA
ALEMA
BARBECUE
TROPICAL
SUPREMA
LOUISIANA
CHEESEHAM
EUROPA
HAVAIANA
CAMPONESA

Sample Output
0 15 G
2 11 C
7 18 A
4 8 C
16 13 B
4 15 E
10 3 D
5 1 E
19 7 C
11 11 H

2 2 1
AB
CD
AB
 
*/
